package uk.ac.shef.dcs.oak.jate.test;

import java.io.IOException;
import java.util.Date;
import java.util.Map;

import uk.ac.shef.dcs.oak.jate.JATEException;
import uk.ac.shef.dcs.oak.jate.core.algorithm.NCValueAlgorithm;
import uk.ac.shef.dcs.oak.jate.core.algorithm.NCValueFeatureWrapper;
import uk.ac.shef.dcs.oak.jate.core.context.ContextExtraction;
import uk.ac.shef.dcs.oak.jate.util.control.Lemmatizer;
import uk.ac.shef.dcs.oak.jate.util.control.StopList;



/**
 * @author YUANYUHU
 *
 */
public class YYH_TestNCValue {
	
	public static final String output = "D:\\zzz_yyhtest\\output";
	
	public static void main(String[] args) throws IOException, JATEException {
		
		System.out.println("Started "+ TestNCValue.class+" at: " + new Date() + "... For detailed progress see log file jate.log.");
//		String[] argument = new String[]{JATEProperties.getInstance().getCorpusPath(), JATEProperties.getInstance().getResultPath()};
		
		/* Call the C-Value Algorithm first to get the resultant candidates with CValue score. */
//		AlgorithmTester tester = TestCValue.CValueTester(argument);
		AlgorithmTester tester = YYH_TestCvalue.TestCValue(output);
		
		//Ankit: added the required parameters stoplist and lemmatizer
		StopList stoplist = new StopList(true);   //这里的true or false 是大小写是否敏感
		Lemmatizer lemmatizer = new Lemmatizer();  //这里是根据字典，还原词本身的形态，这部分的内容做英文的时候可以专门的再处理一次，中文用不到
		
		/* Get the list of context words by making use of the 'top candidates' of CValue resultant term candidates. */
		ContextExtraction contextExtract = new ContextExtraction(tester,stoplist,lemmatizer);
		Map<String, Double> contextWords = contextExtract.Extract();
		
		/* Register the NC-Value Algorithm and get it executed. */
		AlgorithmTester NCTester = new AlgorithmTester();
		//Ankit: added the required parameters stoplist and lemmatizer
		NCTester.registerAlgorithm(new NCValueAlgorithm(contextExtract,stoplist,lemmatizer), new NCValueFeatureWrapper(contextWords, tester));
		NCTester.execute(tester.getIndex(), output);
		System.out.println("Ended at: " + new Date());		
	}	 

}
